Skip to content

feat(orchestrator): add mention-chain coordination for Gitea mentions#832

Merged
AlexMikhalev merged 6 commits intomainfrom
task/760-mention-chain-tracker
Apr 22, 2026
Merged

feat(orchestrator): add mention-chain coordination for Gitea mentions#832
AlexMikhalev merged 6 commits intomainfrom
task/760-mention-chain-tracker

Conversation

@AlexMikhalev
Copy link
Copy Markdown
Contributor

Summary

  • add mention-chain coordination primitives for Gitea-driven agent handoff in terraphim_orchestrator
  • wire chain metadata through dispatch, runtime state, and agent run records
  • document the design plus verification/validation evidence in .docs/

Scope

  • MentionChainTracker with depth guard, self-mention rejection, and structured context building
  • MentionDriven metadata: chain_id, depth, parent_agent
  • MentionConfig.max_mention_depth
  • mention-driven task context includes available downstream agents and remaining depth
  • AgentRunRecord captures mention-chain metadata
  • docs-only follow-up: research, design, verification, and conditional validation reports

Verification Plan And Results

  • Plan source: .docs/verification-inter-agent-orchestration.md
  • cargo test -p terraphim_orchestrator: PASS (516 passed; 0 failed)
  • cargo clippy -p terraphim_orchestrator -- -D warnings: PASS
  • cargo clippy --workspace --all-targets -- -D warnings: PASS
  • UBS: no real critical findings; one test-only panic! false positive was triaged and captured as a learning
  • Traceability and defect register are included in the verification report

Validation Plan And Results

  • Plan source: .docs/validation-inter-agent-orchestration.md
  • Status: Conditional
  • Technical acceptance criteria met for bounded mention recursion, structured mention context, metadata capture, and non-regression of existing orchestrator flows
  • Remaining condition: formal stakeholder/UAT sign-off was not available in-session

Artefacts

  • .docs/research-inter-agent-orchestration.md
  • .docs/design-inter-agent-orchestration.md
  • .docs/verification-inter-agent-orchestration.md
  • .docs/validation-inter-agent-orchestration.md

Issues

Step 1/6 of #144 - Inter-agent orchestration via Gitea mentions.

- New mention_chain.rs: MentionChainTracker with check() and build_context()
- MentionChainError: SelfMention, DepthExceeded, CycleDetected
- MentionContextArgs for structured context building
- DEFAULT_MAX_MENTION_DEPTH = 3
- DispatchTask::MentionDriven gains chain_id, depth, parent_agent fields
- MentionConfig gains max_mention_depth (default: 3)
- 14 unit tests all passing

Refs #760
Step 3/6 of #144 - Inter-agent orchestration via Gitea mentions.

- Add resolve_mention_chain() helper to determine chain_id/depth/parent
- Add MentionChainTracker::check() gate before all mention spawns
- Add MentionChainTracker::build_context() for structured handoff context
- Apply chain tracking to all 3 dispatch sites:
  - Qualified mentions (@adf:project/agent)
  - Unqualified agent mentions (@adf:agent)
  - Persona mentions (@adf:persona)
- Add mention_chain_id/mention_depth to ManagedAgent
- Replace flat mention context with structured markdown block

Refs #762
…able agents in context

- Fix AgentRunRecord construction: extract chain fields from active_agents
  via .get() instead of referencing non-existent local variable
- Add mention_parent_agent field to ManagedAgent, set at all 3 dispatch sites
- Pass available_agents in MentionContextArgs so spawned agents know who
  they can chain to
- Add 2 tests for available_agents in mention context output

Refs #763 Refs #764 Refs #144
- polish design and research artefacts for issue #144
- add verification report with traceability and test evidence
- add conditional validation report with acceptance evidence

Refs #144 Refs #760 Refs #761
- Fix Unicode truncation panic: use char-boundary-safe slicing
- Post rejection comments when mention chain check fails (3 polling sites)
- Wire webhook dispatch through MentionChainTracker::check() and
  build_context() so depth limits apply uniformly
- Store chain metadata on webhook-spawned agents
- Add test for multibyte truncation boundary safety

Refs #144
@AlexMikhalev AlexMikhalev merged commit ccbf26f into main Apr 22, 2026
7 checks passed
@AlexMikhalev AlexMikhalev deleted the task/760-mention-chain-tracker branch April 22, 2026 19:01
AlexMikhalev added a commit that referenced this pull request Apr 22, 2026
…#832)

Adds inter-agent orchestration via mention chain tracking. Fixes #144. Closes #760, #761, #762, #763, #764, #765.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant